import { getScenarioList } from '/@/api/maintenance-center/microservice-govern/governance/governance';

export const governanceColumns = [
  {
    title: '策略ID',
    dataIndex: 'id',
    width: 200,
  },
  {
    title: '业务场景',
    dataIndex: 'scenarioName',
    width: 200,
  },
  {
    title: '策略名称',
    dataIndex: 'strategyName',
    width: 200,
  },
  {
    title: '治理策略方法',
    dataIndex: 'strategyMethod',
    width: 200,
  },
  {
    title: '治理策略参数',
    dataIndex: 'viewParams',
    width: 200,
  },
  {
    title: '最后更新时间',
    dataIndex: 'lastUpdateTime',
    width: 200,
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: 200,
  },
];

export const searchGovernanceSchema = [
  {
    field: 'scenarioId',
    label: '业务场景',
    component: 'ApiSelect',
    labelWidth: 100,
    colProps: {
      span: 6,
    },
    componentProps: () => {
      return {
        api: getScenarioList,
        placeholder: '请选择业务场景',
        resultField: 'list',
        labelField: 'scenarioName',
        valueField: 'id',
      };
    },
  },
  {
    field: 'strategyMethod',
    label: '治理策略类型',
    component: 'Select',
    labelWidth: 100,
    colProps: {
      span: 6,
    },
    componentProps: {
      options: [
        {
          label: 'retry',
          value: 'retry',
        },
        {
          label: 'rateLimiting',
          value: 'rateLimiting',
        },
        {
          label: 'bulkhead',
          value: 'bulkhead',
        },
        {
          label: 'circuitBreaker',
          value: 'circuitBreaker',
        },
      ],
      placeholder: '请选择治理策略类型',
    },
  },
];
